package com.json;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/23 22:43
 * @since JDK 1.8
 */
public class Json {

    public <T> T outFieldList(T t){
        try {
            ObjectMapper mapper = new ObjectMapper();
            String str=mapper.writeValueAsString(t);
            System.out.println(str);
            str=str.replaceAll("标题","个大头鬼");
            System.out.println("====================================");
            Class<T> cls=(Class<T>) t.getClass();
            t= JSON.parseObject(str,cls);
        }catch (Exception e){
            e.printStackTrace();
        }
        return t;
    }


}
